﻿using System;

namespace RpcModel.Tran.Model
{
    public class CurTranState : IEquatable<CurTranState>
    {
        /// <summary>
        /// 事务Id
        /// </summary>
        public Guid TranId { get; set; }

        /// <summary>
        /// 事务协调服务所在区
        /// </summary>
        public int RegionId { get; set; }
        /// <summary>
        /// 事务协调服务所在集群
        /// </summary>
        public long RpcMerId { get; set; }


        public override bool Equals(object obj)
        {
            if (obj is CurTranState i)
            {
                return i.TranId == this.TranId;
            }
            return false;
        }

        public bool Equals(CurTranState other)
        {
            if (other == null)
            {
                return false;
            }
            return other.TranId == this.TranId;
        }

        public override int GetHashCode()
        {
            return this.TranId.GetHashCode();
        }
    }
}
